package com.killer.util;

import java.util.Calendar;
import java.util.Date;

/**
 * @author ：Killer
 * @date ：Created in 20-12-31 下午4:07
 * @description：${description}
 * @modified By：
 * @version: version
 */
public class DateUtil {

    public static Date getNow(){
        return new Date();
    }

    public static Date addMinutes(Date date, int amount) {
        return add(date, Calendar.MINUTE, amount);
    }

    private static Date add(Date date, int calendarField, int amount) {
        if (date == null) {
            throw new IllegalArgumentException("The date must not be null");
        }
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        c.add(calendarField, amount);
        return c.getTime();
    }
}
